package com.itheima.controller;

import com.itheima.common.constant.MessageConstant;
import com.itheima.common.entity.Result;
import com.itheima.security.SpringSecurityUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AdminController {
    @Autowired
    private SpringSecurityUserService userService;
    @PostMapping ("/login")
    public Result hello(String username) {
        UserDetails user = userService.loadUserByUsername(username);
        return new Result(true, MessageConstant.LOGIN_SUCCESS,user);
    }

}
